/********************************************************************************
 *  
 *  Product: GSAOBKeyMatches
 *  Description: A C# API for Responsing to Google Search Appliance OneBoxModule.
 *
 *  (c) Copyright 2007 
 *  
********************************************************************************/
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Text;


/// <summary>
/// <para>Author Albert Ghukasyan</para>
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class KMService : System.Web.Services.WebService
{
    public KMService()
    {
        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public void KeyMatches()
    {
        string URL_PREFIX = HttpContext.Current.Request.Url.OriginalString.Replace(HttpContext.Current.Request.Url.Query,"");
        string KeyMatchFile = System.Configuration.ConfigurationManager.AppSettings["KeyMatchFile"];
        GSAOBKeyMatchesLib.Client.KeyMatch km = new GSAOBKeyMatchesLib.Client.KeyMatch();
        km.init(URL_PREFIX, KeyMatchFile);
        km.processRequest(HttpContext.Current.Request, URL_PREFIX,KeyMatchFile);
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.ContentType = "text/xml";
        HttpContext.Current.Response.Write(km.OutputStream);
        HttpContext.Current.Response.End();
    }
}

